package com.asiainfo.work.controller;

import com.asiainfo.work.entity.UserGroup;
import com.asiainfo.work.entity.UserMergeCode;
import com.asiainfo.work.request.merge.MergeRequest;
import com.asiainfo.work.service.master.MergeService;
import com.asiainfo.work.utils.BaseResponse;
import com.asiainfo.work.utils.PageResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: bf
 * @date: 2021/1/4-10:20
 * 合并代码controller
 */
@RestController
@Api(tags = "git合并代码接口")
@CrossOrigin
public class MergeController {

    @Autowired
    private MergeService masterService;

    /**
     * 查询代码合并详情
     * @param mergeRequest 查询条件
     * @return 分页返回代码合并详情
     */
    @PostMapping("query")
    @ApiOperation(value = "查询代码合并信息", notes = "查询代码合并信息", httpMethod = "POST")
    public BaseResponse<PageResponse<UserMergeCode>> query(@RequestBody MergeRequest mergeRequest){
        return masterService.query(mergeRequest);
    }

    /**
     * 查询用户信息
     * @return 分页返回用户详情
     */
    @GetMapping("queryUserList")
    @ApiOperation(value = "查询代码合并信息", notes = "查询代码合并信息", httpMethod = "GET")
    public BaseResponse<List<UserGroup>> queryUserList(){
        return masterService.queryUserList();
    }

}
